import os
def interrupt_callback(signum, frame):
    # 处理中断逻辑...
signal.signal(signal.SIGINT, interrupt_callback)